#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 2e5+10;

int op[N],x[N],y[N],n,cnt,b[N];
char s[N];

namespace T{
	set <pii> tr[N];
	void add(int x,pii v){for(;x;x -= x & -x) tr[x].insert(v);}
	void del(int x,pii v){for(;x;x -= x & -x) tr[x].erase(v);}
	pii query(int x,pii bas){
		pii v = {2e9,2e9};
		for(;x <= cnt;x += x & -x){
			set <pii> :: iterator it = tr[x].lower_bound(bas);
			if(it != tr[x].end()) v = min(v,*it);
		}
		return v;
	}
}
	
int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1;i <= n;i++){
		scanf("%s",s + 1); op[i] = s[1] == 'a' ? 0 : s[1] == 'r' ? 1 : 2;
		x[i] = in,y[i] = in; if(op[i] == 2) x[i]++,y[i]++; b[++cnt] = y[i];
	}
	sort(b + 1,b + cnt + 1); cnt = unique(b + 1,b + cnt + 1) - b - 1;
	for(int i = 1;i <= n;i++){
		y[i] = lower_bound(b + 1,b + cnt + 1,y[i]) - b;
		if(op[i] == 0) T::add(y[i],{x[i],y[i]});
		else if(op[i] == 1) T::del(y[i],{x[i],y[i]});
		else{
			pii ans = T::query(y[i],{x[i],y[i]});
			if(ans.fi == 2e9) puts("-1");
			else printf("%d %d\n",ans.fi,b[ans.se]);
		}
	}
	return 0;
}
